package com.car.Test;

import com.car.dao.UserCarDao;
import com.car.dao.impl.UserCarDaoImpl;
import com.car.domain.UserCar;
import org.junit.Test;

import java.util.List;

public class UserCarDaoImplTest {
    private static final UserCarDao userCarDao=new UserCarDaoImpl();
    @Test
    public void add() throws Exception {
        UserCar userCar = new UserCar();
        userCar.setCarId(1);
        userCar.setUserId(10);
        userCarDao.add(userCar);
    }

    @Test
    public void delete() throws Exception {
        int delete=userCarDao.delete(1);
    }

    @Test
    public void update() throws Exception {
        UserCar userCar=userCarDao.queryById(1);
        userCar.setUserId(20);
        userCarDao.update(userCar);
    }

    @Test
    public void queryById() throws Exception {
UserCar userCar=userCarDao.queryById(1);
        System.out.println(userCar);
    }

    @Test
    public void queryAll() throws Exception {
        List<UserCar> userCars = userCarDao.queryAll();
        System.out.println(userCars);
    }

}